package com.it.tydic.estate.module.controller.cwgl;

import com.it.tydic.estate.common.annotation.ControllerDesc;
import com.it.tydic.estate.common.aop.Result;
import com.it.tydic.estate.common.constants.LogConstants;
import com.it.tydic.estate.module.controller.common.LoginController;
import com.it.tydic.estate.module.model.inner.TbCw;
import com.it.tydic.estate.module.service.CwglService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @description:   车位区域管理Controller
 * @author: zhangshuo
 * @createDate: 2020/03/02
 * @version: 1.0
 */
@Api(tags ="车位管理———车位区域管理")
//@Api(value = "车位区域管理数据接口",description = "车位管理———车位区域管理 ")
@RestController("/cwqygl")
public class TbCwController {
    @Autowired
    private CwglService cwglService;
    private static final Logger logger=  LoggerFactory.getLogger(LoginController.class);

    /*模糊查询车位区域*/
    @PostMapping ("/selectByCwPage")
    @ApiOperation(value = "条件查询车位区域", notes = "条件查询车位区域")
    public Result selectByPage(@RequestBody Map<String,Object> tbCw) {
        logger.info("sucess");
        return cwglService.selectByPage(tbCw);
    }
    /*批量删除车位区域*/
    @PostMapping ("/deleteByTbCw")
    @ControllerDesc(description = LogConstants.delete_data)
    @ApiOperation(value = "批量删除", notes = "批量删除")
    public Result deleteByTbCw(@RequestBody List<String> list) {
        logger.info("sucess");
        return cwglService.deleteByTbCw(list);
    }
    /**
     * 新增或修改车位区域
     * @param
     * @return
     */
    @PostMapping ("/insertTbCwOrUpdata")
    @ControllerDesc(description = LogConstants.addOrUpdate_data)
    @ApiOperation(value = "车位区域新增或修改", notes = "车位区域新增或修改")
    public Result insertTbCwOrUpdata(@RequestBody TbCw tbCw) {
        logger.info("sucess");
        return cwglService.insertTbCwOrUpdata(tbCw);
    }
}
